package com.ruoyi.personnel.oa.file.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.personnel.oa.file.domain.File;
import com.ruoyi.personnel.oa.file.domain.FileCond;
import com.ruoyi.personnel.oa.file.mapper.FileMapper;
import com.ruoyi.utils.ID.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class FileServiceImpl implements IFileService{
    @Autowired
    private FileMapper fileMapper;
    @Autowired
    private IdUtil idUtil;

    @Override
    public List<File> selectFileList(FileCond cond) {
        return fileMapper.selectFileList(cond);
    }

    @Override
    public boolean selectFileById(String fileId) {
        return StringUtils.isNotNull(fileMapper.selectFileById(fileId));
    }

    @Override
    public int insertFile(File file) {
        file.setFileId(idUtil.createFileId());
        return fileMapper.insertFile(file);
    }
}
